package com.example.controller;

import com.example.common.Result;
import com.example.entity.User;
import com.example.entity.UserActions;
import com.example.entity.Video;
import com.example.service.VideoService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/video")
public class VideoController {
    @Resource
    private VideoService videoService;
    @PostMapping("/add")
    public Result addViedo(@RequestBody Video video){
        return videoService.addVideo(video);
    }
    @PostMapping("/listByUser")
    public Result listByUser(@RequestBody User user){
        return videoService.listByUser(user);
    }
    @PostMapping("/search")
    public Result searchViedo(@RequestBody Video video){
        return videoService.searchViedo(video);
    }
    @PostMapping("/get")
    public Result getViedo(@RequestBody Video video){
        return videoService.getViedo(video);
    }
    @PostMapping("/like")
    public Result likeViedo(@RequestBody UserActions userActions){
        return videoService.likeViedo(userActions);
    }
    @PostMapping("/unlike")
    public Result unLikeViedo(@RequestBody UserActions userActions){
        return videoService.unLikeViedo(userActions);
    }
    @PostMapping("/update")
    public Result update(@RequestBody Video video){
        return videoService.updateVideo(video);
    }
    @PostMapping("/listAll")
    public Result listAll(){
        return videoService.listAll();
    }
    @PostMapping("/delete")
    public Result delete(@RequestBody Video video){
        return videoService.delete(video);
    }
}
